Over the last few decades, along with an advancement of technology for semiconductor, a clock frequency and performance of a microprocessor have been rapidly increased and improved, respectively. However, in recent years, miniaturization in semiconductor process has approached its limit, and an increase in clock frequency of the microprocessor has slowed down. In order to improve the performance of microprocessor under such circumstances, there is in the semiconductor industry a trend in which a plurality of processor cores (hereinafter referred to as cores) are provided to a microprocessor die instead of increasing the clock frequency. A multi-core CPU provided with two to four cores in a die has already been distributed for a personal computer for general use. Also, research and development of a processor provided with a few dozen or more cores are intensively conducted. The processor with a few dozen or more cores is referred to as a many-core processor, or simply as a many-core.
Also, a die provided with plurality of cores appeared for a specific purpose processor such as DSP (Digital Signal Processor), image processor, and network processor earlier than for a general purpose processor. A die will tend to be provided with more and more processors in the future, due to the above mentioned problems in the technology for semiconductor.
A transition from a single-core processor to a multi-core processor and further to a many-core processor brings a change to programming. It is widely recognized that programming suitable for parallel processing is required in order to bring out abilities of the multi-core processor or the many-core processor to the maximum extent.
As one of programming for accelerating a process by using a plurality of processor cores, a pipelining is generally known. The pipelining in the programming is essentially the same as a conveyer system with a belt conveyer in a factory. In the factory, a series of working processes are divided into a plurality of processes which can be executed independently, and workers (or processing machineries) are assigned to the processes respectively. The workers are arranged along the belt conveyer and each worker perform an assigned process to a working object. Since the plurality of workers perform independently and in parallel the plurality of processes of the series of processes, before a series of working processes for a working object finishes, a series of working processes for the next working object starts. Therefore, the performance in the whole factory is excellent in the above case compared to a case in which a worker performs the whole of series of working processes. In the pipelining in the programming, a plurality of processor cores linked together physically or logically corresponds to a plurality of workers and each of the processor is in charge of a part of a series of processes. The processor cores perform the assigned processes along a flow of data corresponding to a start instruction.
However, there are not a few applications unsuitable for the pipelining. In particular, in an application in which a transaction of database executed in the processing, when successive reference and update are performed for a specific region of the database, an exclusive control of access is required to maintain the database consistency. The exclusive control may cause a temporal stop of the pipeline (or a pipeline stall) and remarkable decrease the process performance.
In relation to a method for performing in parallel a series of processes including access to a database, Japanese Laid Open Patent Application (JP-P2004-227569A) discloses a method for managing correction of a persistent object in a multiuser environment.
Also, Japanese Laid Open Patent Application (JP-P2000-76107A) discloses a database management method. According to the method, time for reading data from a database and time for writing data in the database are reduced as much as possible and the latest write data can be read from the database.
The present inventor has recognized as follows.
A conventional pipelining cannot be easily applied to an application including access to a database. The reason why the pipelining cannot be easily applied to the application will be described by using a specific example. FIG. 1 shows a simple accounting apparatus 900 as an example. The accounting apparatus 900 performs accounting through pipelining of three processor cores 901-1 to 901-3.
A card (hereinafter referred to as a name card 910) on which a name of a person is shown is inputted to the accounting apparatus 900. The accounting apparatus 900 includes an accounting information database 902. The accounting information database 902 includes a plurality of records 920, and each of the records 920 includes two pieces of column data of a person's name 921 and a total amount 922. Every time receiving a name card 910, the accounting apparatus 900 adds 1 to a total amount 922 corresponding to the person's name indicated the name card 910.
The accounting apparatus 900 divides this operation into the following three steps S91 to S93 and executes them through pipelining.    Step S91: a record 920 having a person's name 921 corresponding to the inputted name card 910 is searched from the accounting information database 902 and a current total amount 922 in the searched record 920 is obtained. The obtained total amount 922 is assigned to X.    Step S92: 1 is added to X.    Step S93: the total amount 922 in the record 920 searched in Step S91 is updated with X.
In response to the input of the name card 910, the processor core 901-1 executes Step S91. The processor core 901-2 executes Step S92 upon receipt of the results obtained by the processor core 901-1. The processor core 901-3 executes Step S93 upon receipt of the results obtained by the processor core 901-2. That is, the accounting apparatus 900 processes in parallel three name cards 910 at maximum through pipelining.
However, there is a problem that accounting is not normally executed when the same name card 910 is successively inputted to the accounting apparatus 900. FIG. 2 is a time chart for illustrating the problem.
Referring to the time chart of FIG. 2, the accounting apparatus 900 successively receives three times a name card 910 indicating “TANAKA”. A desired result is that the total amount 922 for “TANAKA” is increased by 3 in the accounting information database 902. However, in fact, the total amount 922 is only increased by 1.
The reason why the desired result cannot be obtained is that the isolation of the accounting information database 902 is not secured, and therefore the series of database transactions in the above-described Steps S91 to S93 is not serialized.
Meanwhile, when the accounting information database 902 is provided with a function for serializing the transactions, high process performance due to the pipelining is not obtained. For example, the accounting information database 902 is assumed to be a database provided with the function for serializing the transactions such as relational database. In this case, the record 920 corresponding to “TANAKA” is locked, and the exclusive control is carried out. The accounting apparatus 900 operates according to a time chart in FIG. 3, and the correct total amount 922 is obtained.
However, since a pipeline stall occurs due to the influence of the exclusive control, only one of three processor cores 901-1 to 901-3 can operate at a time. In other words, in spite of using the three processor cores, the process performance is almost same as that in a case of a single processor core.
As described above, in case of accelerating process by pipelining the series of processes including access to the database, a mechanism is required that can prevent occurrence of inconsistency in results even if the database transactions are executed in parallel. The mechanism is implemented by using the database provided with the function for serializing the transactions. However, the database provided with the function for serializing locks a part of regions of the database in executing the exclusive control, and therefore the pipeline stall may occur, resulting in a reduction in process performance.
It should be noted that the transaction management method disclosed in Japanese Laid Open Patent Application (JP-P2004-227569A) is one for a database in a multithreaded environment, but is not intended to solve a pipeline stall caused by a data hazard that is a problem in parallel programming based on the pipelining. Here, the data hazard means inconsistency in data content caused by inconsistency relevant to the order of reference and update of certain data in the database. Moreover, in the method disclosed in Japanese Laid Open Patent Application (JP-P2004-227569A), when a thread accesses certain data in the database, the other threads can not execute writing for the data. Accordingly, this method cannot solve the pipeline stall caused by the data hazard, and therefore an advantage of the multithread is insufficient.
An object of the database management method disclosed in Japanese Laid Open Patent Application (JP-P2000-76107A) is to reduce time for reading data and time for writing data for a database provided with a function for serializing transactions. However, a configuration is not indicated in which latest write data can be read from the database when transactions are executed in parallel through pipelining.